package com.zabra.zl.ui.godeal.tab.tab_haved;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.zabra.zl.R;
import com.zabra.zl.base.BaseMvpFragment;
import com.zabra.zl.data.DetailsDealBean;
import com.zabra.zl.myview.state_layout.OtherView;
import com.zabra.zl.ui.godeal.tab.tab_haved.contract.TabHavedContract;
import com.zabra.zl.ui.godeal.tab.tab_haved.presenter.TabHavedPresenter;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

@SuppressLint("ValidFragment")
public class TabHaved extends BaseMvpFragment<TabHavedPresenter> implements TabHavedContract.View {
    @BindView(R.id.recycler)
    RecyclerView recycler;
    @BindView(R.id.otherview)
    OtherView otherview;
    Unbinder unbinder;
    private Adp adp;
    private List<DetailsDealBean.PositionsBean> list;

    public TabHaved(List<DetailsDealBean.PositionsBean> list) {
        this.list = list;
    }

    @Override
    protected void initView(View view) {
        otherview.setHolder(mHolder);
        if (list.size() == 0) {
            otherview.showEmptyView();
        } else {
            otherview.showContentView();
            recycler.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
            recycler.setNestedScrollingEnabled(false);
            adp = new Adp(R.layout.item_haved, list);
            recycler.setAdapter(adp);
            adp.openLoadAnimation();
        }

    }

    @Override
    protected int getLayoutId() {
        return R.layout.tab_haved;
    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void onError(Throwable throwable) {

    }

}
